<?php

namespace Modules\Backend\Http\Controllers\Auth;

use App\Models\Admin;
use Illuminate\Routing\Controller;
use Modules\Backend\Auth\RegistersUsers;

class RegisterController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Register Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users as well as their
    | validation and creation. By default this controller uses a trait to
    | provide this functionality without requiring any additional code.
    |
    */

    use RegistersUsers;


    protected $redirectTo = '';


    public function __construct()
    {
        $this->redirectTo=route("backend.index.index");
        $this->middleware('guest:backend');
    }


    protected function create(array $data)
    {
        return Admin::create([
            'user_name' => $data['user_name'],
            'email' => $data['email'],
            'phone' => '18906715574',
            'password' => bcrypt($data['password']),
        ]);
    }
}
